//-----------------------------------------------------------------------
// <copyright file="SendEmailService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class SendEmailService
    {
        #region SendEmail

        public static void CreateSendEmail(SendEmail sendEmail)
        {            
            try
            {
                SendEmailDAO sendEmailDAO = new SendEmailDAO();
                sendEmailDAO.CreateSendEmail(sendEmail);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateSendEmailException, ex);
            }
        }        

        public static void UpdateSendEmail(SendEmail sendEmail)
        {            
            try
            {
                SendEmailDAO sendEmailDAO = new SendEmailDAO();
                sendEmailDAO.UpdateSendEmail(sendEmail);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateSendEmailException, ex);
            }
        }        

        public static void DeleteSendEmail(long sendEmailId)
        {            
            try
            {
                SendEmailDAO sendEmailDAO = new SendEmailDAO();
                sendEmailDAO.DeleteSendEmail(sendEmailId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteSendEmailException, ex);
            }
        }
        
        public static SendEmail GetSendEmail(long sendEmailId)
        {            
            try
            {
                SendEmailDAO sendEmailDAO = new SendEmailDAO();
                return sendEmailDAO.GetSendEmail(sendEmailId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetSendEmailException, ex);
            }
        }                

        public static SendEmailCollection GetSendEmailList(SendEmailColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                SendEmailDAO sendEmailDAO = new SendEmailDAO();
                return sendEmailDAO.GetSendEmailList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetSendEmailListException, ex);
            }
        }        

        public static SendEmailCollection GetSendEmailList(SendEmailColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                SendEmailDAO sendEmailDAO = new SendEmailDAO();
                return sendEmailDAO.GetSendEmailList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetSendEmailListException, ex);
            }
        }        

	    public static SendEmailCollection GetSendEmailListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                SendEmailDAO sendEmailDAO = new SendEmailDAO();
                return sendEmailDAO.GetSendEmailListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetSendEmailListException, ex);
            }
        }        

        public static SendEmailCollection GetSendEmailListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                SendEmailDAO sendEmailDAO = new SendEmailDAO();
                return sendEmailDAO.GetSendEmailListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetSendEmailListException, ex);
            }
        }        

        #endregion
    }
}